/**
 * 
 * The bomb class represents an explosion on the field.
 * 
 * Author: Matthias Van Eeghem <matthias@van-eeghem.com>
 * All rights reserved.
 * 
 */

package com.bomberman.explosion;

import com.bomberman.core.Element;
import com.bomberman.player.Player;

public class Explosion extends Element
{
	/**
	 * Current bomb tick state.
	 */
	public enum ExplosionState
	{
		JUST_CREATED,
		TICK_ONE,
		TICK_TWO,
		TICK_THREE,
		HAS_TO_BE_REMOVED
	}
	
	/**
	 * Holds the current bomb state
	 */
	private ExplosionState explosionState = ExplosionState.JUST_CREATED;
	/**
	 * This variable holds the owner of the bomb, ergo the player who put the bomb in its location.
	 */
	private Player ownerOfTheBomb;
	
	/**
	 * 
	 * 
	 * @param row
	 * @param column
	 */
	public Explosion(Player owner, int row, int column) 
	{
		super(row, column, Element.ElementType.TYPE_EXPLOSION);
		
		this.ownerOfTheBomb = owner;
	}
	
	/**
	 * This method returns the bomb's owner
	 * 
	 * @return The player object that owns the bomb
	 */
	public Player getBombOwner()
	{
		return ownerOfTheBomb;
	}
	
	/**
	 * Increments the bomb state
	 */
	public void incrementState()
	{
		explosionState = ExplosionState.values()[explosionState.ordinal() + 1];
	}
	
	/**
	 * Returns the bombstate for this bomb.
	 * 
	 * @return The bombstate
	 */
	public ExplosionState getState()
	{
		return explosionState;
	}
	
}
